home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / manageme / tcpdump-.7 / tcpdump- / tcpdump-richard-1.7 / tcpdump-3.0 / configure < prev    next >
Encoding:
Text File  |  1995-04-15  |  2.6 KB  |  121 lines

  1. #!/bin/csh -f
  2. if ( ! -d libpcap || ! -r libpcap/libpcap.a ) then
  3.     set libpcapdir
  4.     set dir=`ls .. | egrep '^libpcap-[0-9]*\.[0-9ab]*$'`
  5.     if ( $#dir > 1 ) set dir="$dir[$#dir]"
  6.     foreach d ( ../$dir ../libpcap /usr/lib /usr/local/lib )
  7.         if ( -d $d ) then
  8.             if ( -r $d/libpcap.a ) then
  9.                 set libpcapdir=$d
  10.                 break
  11.             endif
  12.             if ( -r $d/pcap.h && "$d" == "../$dir" ) then
  13.                 set libpcapdir=$d
  14.                 break
  15.             endif
  16.         endif
  17.     end
  18.     if ( "$libpcapdir" == "" ) then
  19.         echo "configure: can't find libpcap.a"
  20.         echo "configure: (see the README for more info)"
  21.         exit 1
  22.     endif
  23.     echo "configure: using pcap lib installed in $libpcapdir"
  24.     if ( "$libpcapdir" != "/usr/lib" && \
  25.         "$libpcapdir" != "/usr/local/lib" ) then
  26.         rm -f libpcap
  27.         ln -s $libpcapdir libpcap
  28.     endif
  29. endif
  30. if ( -f /bin/uname || -f /usr/bin/uname ) then
  31.     set md=`uname -m`
  32.     set name=`uname -s | tr '[A-Z]' '[a-z]'`
  33.     set vers=`uname -r | sed -e 's/\..*//' -e 's/T1/v1/' | tr '[A-Z]' '[a-z]'`
  34. else if ( -f /bin/arch ) then
  35.     # sun3 only supported machine without uname
  36.     if ( `/bin/arch` != sun3 ) goto bail
  37.     set md=sun3
  38.     set name=sunos
  39.     set vers=3
  40. else
  41.     goto bail
  42. endif
  43. if ( $name == "bsd/386" ) then
  44.     set os=bsd
  45. else if ( $name == "linux" ) then
  46.     set os=linux
  47. else
  48.     set os=$name$vers
  49. endif
  50. switch ( $md )
  51.     case alpha:
  52.     case i386:
  53.     case i486:
  54.     case i586:
  55.         breaksw
  56.  
  57.     case sun3:
  58.         set md=sun3
  59.         breaksw
  60.  
  61.     case sparc:
  62.     case sun4*:
  63.         set md=sun4
  64.         breaksw
  65.  
  66.     case RISC:
  67.         set md=mips
  68.         breaksw
  69.  
  70.     case IP7:
  71.     case IP20:
  72.         set md=mips
  73.         breaksw
  74.  
  75.     default:
  76.         goto bail
  77.         breaksw
  78. endsw
  79. rm -f Makefile md.h os.h
  80. set bpf
  81. set cslip
  82. set dnet
  83. set ethers
  84. set gcc
  85. set solaris
  86. set linux
  87. if ( -e /dev/bpf0 ) set bpf='-e s/^#have-bpf#//'
  88. if ( -f /usr/include/net/slip.h ) set cslip='-e s/^#have-cslip#//'
  89. if ( -f /usr/lib/libdnet.a ) set dnet='-e s/^#have-dnet#//'
  90. foreach f ( /usr/lib/libc.a /lib/libc.a /usr/lib/libc_s.a )
  91.     if ( -f $f ) then
  92.         set libc=$f
  93.         break
  94.     endif
  95. end
  96. if ( "$f" == "" ) then
  97.     echo "configure: couldn't find libc"
  98. else
  99.     nm $libc | grep ether_ntoa > /dev/null
  100.     if ( $status == 0 ) then
  101.         set ethers='-e s/^#have-ethers#//'
  102.         echo "configure: found support for /etc/ethers"
  103.     endif
  104. endif
  105. if ( -x /usr/local/bin/gcc || -x /usr/local/gcc || -x /usr/bin/gcc ) then
  106.     set gcc='-e s/^#have-gcc#//'
  107. endif
  108. if ( "$name$vers" == "sunos5") set solaris='-e s/^#have-solaris#//'
  109. if ( "$name" == "linux") set linux='-e s/^#have-linux#//'
  110. if ( ! -f /usr/include/stdlib.h ) ln -s /dev/null stdlib.h
  111. ln -s md-$md.h md.h
  112. ln -s os-$os.h os.h
  113. sed -e "s/^#$md-$os#//" $bpf $cslip $ethers $dnet $gcc $solaris $linux\
  114.     Makefile.in > Makefile
  115. chmod ug+w Makefile
  116. make depend
  117. exit 0
  118. bail:
  119. echo 'configure: unsupported system'
  120. exit 1
  121.